<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
        <div class="col-xs-12 col-sm-8" style="display:inline-flex;">
            <select id="c-game_id" data-rule="required" class="form-control selectpicker" name="row[group_id]" >
                <option data-type="0" value="0">请选择</option>
                {foreach name="group" item="vo"}
                <option data-type="{$vo.id}" value="{$vo.id}" >{$vo.group_name}</option>
                {/foreach}
            </select>

            <div style="width:15%;margin-left:20px;vertical-align: center;height: 30px;line-height: 30px;color: #a11334;"><a href="#" onclick="addGroup()">添加组</a></div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mobile" class="form-control" maxlength="11" name="row[mobile]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Invite')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-invite" class="form-control" name="row[invite]" type="text">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    function addGroup(){
        layer.open({
            id:1,
            type: 1,
            title:'请输入名称',
            style: 'width:80%;height:auto;',
            content: "<div style='display:flex;justify-content:center;'><textarea id='area' style='width:100%;height:65px;'></textarea></div>",
            btn:['保存','取消'],
            yes:function (index,layero) {
                //获取输入框里面的值
                var closeContent = top.$("#area").val() || $("#area").val();

                if(closeContent){
                    console.log(closeContent);
                }
                $.post("general/staff/addGroup",{"name":closeContent},function(){
                    window.location.reload()
                })
                layer.close(index);
                // 在这里提交数据
            },
            no:function (index,layero) {
                layer.close(index);
            }
        });

    }

</script>
